from Products.KnowledgeEngine.KERL.Engine import Engine
from Products.KnowledgeEngine.Assessment import Assessment

test1 = ['all',
           ['all', 
                   ["assessment", "createdbefore", "2009-01-01"], 
                   ["assessment", "createdafter", "2006-01-01"]],
                   
           ['any', 
                   ["component", "equals", "bar"], 
                   ["component","equals","Hello"]],
        ]

test2 = ["component","equals","Hello"]

test3 = ['all', ['assessment', 'createdbefore', '2009-01-01'], ['assessment', 'createdafter', '2007-01-01']]

test4 = ["text01181706261878808631801", "=", "Foo"]

ass = context.knowledgeengine_assessmentstorageservice

assessment1 = ass.loadAssessment("Brands-28")
component  = context.getComponentByIdentity('text01173323039430345970121')
model      = assessment1.getModel()


namespace = {'component':  component,
             'model':      model,
}

#print Engine().compile( test1, namespace ).toEnglish()
#print Engine().compile( test1, namespace ).execute( assessment1 )

#print "SELECT * FROM assessments WHERE "
print Engine().compile( test4, namespace ).toEnglish()

return printed 